package com.mk.legoscans2.data;

import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

public class ApplicationPreferences {
	
	private SharedPreferences _sharedPreferences;
	public ApplicationPreferences(Context context)
	{
		_sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);		
	}
	
	public void setFavorites(String favourites)
	{
		SharedPreferences.Editor editor = _sharedPreferences.edit();
		editor.putString("favorites", favourites);
		editor.commit();
	}
	
	public String getFavorites()
	{
        return _sharedPreferences.getString("favorites", "");
	}
	
	public void setLastMessageId(int lastMessageId)
	{
		SharedPreferences.Editor editor = _sharedPreferences.edit();
		editor.putInt("lastMessageId", lastMessageId);
		editor.commit();
	}

	public int getLastMessageId() {
		return _sharedPreferences.getInt("lastMessageId", 0);
	}

	public boolean getShowZoomButtons() {
		return _sharedPreferences.getBoolean("prefShowZoomControl", true);
	}

	public String getAccount() {
		return _sharedPreferences.getString("prefAccount", "");
	}
	
	public void setAccount(String account){
		SharedPreferences.Editor editor = _sharedPreferences.edit();
		editor.putString("prefAccount", account);
		editor.commit();
	}

	public int getGcmRegistrationVersion() {
		return _sharedPreferences.getInt("gcmRegistrationVersion", -1);
	}

	public void setGcmRegistrationVersion(int version) {
		SharedPreferences.Editor editor = _sharedPreferences.edit();
		editor.putInt("gcmRegistrationVersion", version);
		editor.commit();
	}
}
